﻿using FreeSql.DataAnnotations;
using System.Collections.Generic;
using System.Text.Json.Serialization;

namespace FYSJcrm.Core.Model.SystemManage
{
    [Table(Name = "FYSJ_Navigation")]
    public class NavigationEntity : BaseEntity
    {
        /// <summary>
        /// 父级Id
        /// </summary>
        public int? ParentId { get; set; }

        /// <summary>
        /// 导航类型
        /// </summary>
        [Column(StringLength = 50)]
        public string NavType { get; set; }

        /// <summary>
        /// 导航名称
        /// </summary>
        [Column(StringLength = 50, IsNullable = false)]
        public string Name { get; set; }

        /// <summary>
        /// 导航标题
        /// </summary>
        [Column(StringLength = 20, IsNullable = false)]
        public string Title { get; set; }

        /// <summary>
        /// 导航图标
        /// </summary>
        [Column(StringLength = 255)]
        public string IconUrl { get; set; }

        /// <summary>
        /// 导航链接
        /// </summary>
        [Column(StringLength = 255)]
        public string LinkUrl { get; set; }

        /// <summary>
        /// 排序Id
        /// </summary>
        public int SortId { get; set; } = 99;

        /// <summary>
        /// 是否锁定
        /// </summary>
        public int IsLock { get; set; } = 0;

        /// <summary>
        /// 操作类型
        /// </summary>
        public string ActionType { get; set; }

        [Navigate(nameof(ParentId)), JsonIgnore]
        public NavigationEntity Navigation { get; set; }

        /// <summary>
        /// 导航父子关系列表
        /// </summary>
        [Navigate(nameof(ParentId))]
        public List<NavigationEntity> Childs { get; set; }
    }
}

